<template>
	<view class="container">
		<view class="box">
			<view class="cell flex-ac flex-b">
				<view class="hd">创建开始时间</view>
				<view class="md" @click="show = true">
					<input type="text" v-model="queryForm.createTimeBegin" placeholder="请选择时间段" disabled placeholder-style="color: #cccccc;" />
				</view>
				<image src='../../../static/img/yjt.png' class="more" mode=""></image>
			</view>
			<view class="cell flex-ac flex-b">
				<view class="hd">创建结束时间</view>
				<view class="md" @click="show2 = true">
					<input type="text" v-model="queryForm.createTimeEnd" placeholder="请选择时间段" disabled placeholder-style="color: #cccccc;" />
				</view>
				<image src='../../../static/img/yjt.png' class="more" mode=""></image>
			</view>
			<view class="cell flex-ac flex-b">
				<view class="hd">订单号</view>
				<view class="md">
					<input type="text" v-model="queryForm.orderSn" placeholder="请输入订单号" placeholder-style="color: #cccccc;" />
				</view>
			</view>
			<view class="cell flex-ac flex-b">
				<view class="hd">客户名称</view>
				<view class="md">
					<input type="text" v-model="queryForm.customerName" placeholder="请输入客户名称" placeholder-style="color: #cccccc;" />
				</view>
			</view>
			<view class="cell flex-ac flex-b">
				<view class="hd">货名</view>
				<view class="md">
					<input type="text" v-model="queryForm.goodsName" placeholder="请输入货名" placeholder-style="color: #cccccc;" />
				</view>
			</view>
		</view>
		<u-picker mode="time" v-model="show" :params="params" title="选择时间" confirm-color="#1684fc" @confirm="startTime"></u-picker>
		<u-picker mode="time" v-model="show2" :params="params" title="选择时间" confirm-color="#1684fc" @confirm="endTime"></u-picker>
	
		<view class="foot" style="position: fixed; left: 0; bottom: 0;">
			<view class="btnBox flex-ac">
				<view class="btn-3 middle" @click="reset">重置</view>
				<view class="btn-1 middle" style="background-color: #1684fc;" @click="search">查询</view>
			</view>
			<x-botSpace></x-botSpace>
		</view>
	</view>
</template>

<script>
	import	{ businessType } from '@/utils/businessType.js'
	export default {
		data() {
			return {
				queryForm: {
					createTimeBegin: '', // 创建时间：开始
					createTimeEnd: '', // 创建时间：结束
					customerName: '', // 客户名称
					goodsName: '', // 货名名称
					orderSn: '', // 订单号
				},
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				show: false,
				show2: false,
				timeType: '',
				createTime: '',
				releaseTime: '',
				finishTime: '',
				businessType: businessType,
				businessTypeName: '',
				show3: false,
				prijectList: [],
				show4: false,
				show5: false,
				show6: false,
			}
		},
		onLoad(opt) {
			if (opt) console.log('opt:', opt)
			if(uni.getStorageSync('dds_form')) this.queryForm = uni.getStorageSync('dds_form')
		},
		methods: {
			search(){
				let pages = getCurrentPages()
				let prevPage = pages[pages.length - 2]
				prevPage.$vm.queryForm = Object.assign(prevPage.$vm.queryForm, this.queryForm)
				prevPage.$vm.searchWords = `${this.queryForm.createTimeBegin || ''} ${this.queryForm.createTimeEnd || ''} ${this.queryForm.goodsName || ''}  ${this.queryForm.orderSn || ''} ${this.queryForm.carNo || ''} ${this.queryForm.driverName || ''} ${this.queryForm.transportNo || ''}`
				uni.setStorageSync('dds_form', this.queryForm)
				this.$Jump.Back(1) 
			},
			
			reset(){
				this.queryForm = {
					createTimeBegin: '', // 创建时间：开始
					createTimeEnd: '', // 创建时间：结束
					customerName: '', // 客户名称
					goodsName: '', // 货名名称
					orderSn: '', // 订单号
				} 
				uni.setStorageSync('dds_form', this.queryForm)
			},
			
			

			startTime(e){
				// this.queryForm.createTimeBegin = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
				this.queryForm.createTimeBegin = e.year + '-' + e.month + '-' + e.day 
			},
			endTime(e){
				// this.queryForm.createTimeEnd = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
				this.queryForm.createTimeEnd = e.year + '-' + e.month + '-' + e.day
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f9f9f9;
	}
</style>

<style lang="scss" scoped>
	// @import './style.scss';
	.btn-3{
		width: 200rpx;
		height: 90rpx;
		border: 2rpx solid #b3b3b3;
		border-radius: 10rpx;
		margin-right: 20rpx;
		color: #999999;
		font-size: 30rpx;
	}
	.box {
		width: 100%;
		background-color: #fff;
		padding: 0 20rpx;
		margin-bottom: 20rpx;

		.cell {
			width: 100%;
			border-bottom: 2rpx solid #F5F7FB;
			height: 110rpx;

			.hd {
				font-size: 28rpx;
				color: #333;
				// font-weight: bold;
				flex-shrink: 0;
				margin-right: 20rpx;
			}

			.md {
				flex: 1;
				text-align: right;
				font-size: 28rpx;
				color: #333;
				// font-weight: bold;
				flex-shrink: 0;

				input {
					width: 100%;
					height: 110rpx;
					line-height: 110rpx;
				}

				textarea {
					width: 100%;
					// height: 110rpx;
					// padding-top: 20rpx;
				}
			}

			.bd {
				font-size: 30rpx;
				color: #333;
				// font-weight: bold;
				margin-left: 10rpx;
			}

			.bn-btn {
				width: 130rpx;
				height: 70rpx;
				background: #f7f7f7;
				border-radius: 6rpx;
				color: #999;
				font-size: 30rpx;
			}

			.bn-btn:first-child {
				margin-right: 20rpx;
			}

			.sel {
				color: #1684fc;
				border: 2rpx solid #1684fc;
			}
		}

		.cell:last-child {
			border: none;
		}
	}
</style>